package com.mbmall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.common.valid.AddGroup;
import com.common.valid.ListValue;
import com.common.valid.UpdateGroup;
import com.common.valid.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author cyt
 * @email cyt123@gmail.com
 * @date 2023-02-09 12:33:30
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotNull(message = "修改必须制定ID",groups = {UpdateGroup.class})
	@Null(message = "新增不指定ID",groups ={AddGroup.class} )
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名必须提交",groups ={AddGroup.class,UpdateGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotEmpty(groups ={AddGroup.class})
	@URL(message ="logo必须是一个合法的URL地址",groups ={AddGroup.class,UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 * 自定义校验
	 * 自定义校验注解
	 * 自定义校验器
	 * 关联检验注解和校验器
	 */
	@NotNull(groups ={UpdateStatusGroup.class})
	@ListValue(vals={0,1},groups ={AddGroup.class, UpdateStatusGroup.class},message="必须提交指定数字")
	private Integer showStatus;
	/**
	 * 检索首字母
	 *
	 */
	@NotEmpty(groups ={AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",message="检索首字母必须是一个字母",groups ={AddGroup.class,UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@NotNull
	@Min(value=0,message="排序必须大于等于0",groups ={AddGroup.class,UpdateGroup.class})
	private Integer sort;

}
